package com.southminority.ethnic.controller.language;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.southminority.ethnic.common.result.R;
import com.southminority.ethnic.controller.alioss.vo.OssFileReqVo;
import com.southminority.ethnic.controller.language.vo.LanguagePageResq;
import com.southminority.ethnic.controller.language.vo.PageKeyReqVo;
import com.southminority.ethnic.pojo.MinorityLanguageCulture;
import com.southminority.ethnic.pojo.MinorityLanguageSpeech;
import com.southminority.ethnic.service.language.MinorityLanguageSpeechService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Tag(name = "语言数据库-词汇对比",description ="词汇对比" )
@RestController
@RequestMapping("/api/language-speech")
public class LanguageSpeechController {
    @Autowired
    private MinorityLanguageSpeechService  service;

    //关键词分页查询
    @PostMapping("/pagekey")
    @Operation(summary = "关键词分页查询")
    public R<LanguagePageResq<MinorityLanguageSpeech>> pagekey(@RequestBody PageKeyReqVo pageKeyReqVo) {
        try {
            return R.ok(service.selectPageKey(
                    pageKeyReqVo.getPageNum(),
                    pageKeyReqVo.getPageSize(),
                    pageKeyReqVo.getKey(),
                    pageKeyReqVo.getMinorityIds()));
        } catch (Exception e) {
            log.error(e.getMessage());
            return R.fail(e.getMessage());
        }
    }


}
